package cn.jolyoulu.adminweb.entity.bo.form;

import lombok.Data;
import cn.jolyoulu.cmnservice.entity.dto.AddMenuDTO;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * @Author LuZhouJin
 * @Date 2023/3/16
 */
@Data
public class SysMenuFormBO {

    /**id*/
    private String id;

    /**父级编号*/
    private String parentId;

    /**菜单名称*/
    @NotBlank(message = "menuName不能为空")
    private String menuName;

    /**菜单类型（1菜单 2权限）*/
    @NotNull(message = "menuType不能为空")
    private Integer menuType;

    /**本级排序号（升序）*/
    private Integer treeSort;

    /**菜单图标*/
    private String icon;

    /**权限标识*/
    private String permission;

    /**路由地址*/
    private String path;

    /**组件路径*/
    private String component;

    /**是否隐藏路由: 0否,1是*/
    private Integer hidden;

    /**是否显示（0否 1是）*/
    private Integer isShow;

    public static AddMenuDTO toAddMenuDTO(SysMenuFormBO bo) {
        return new AddMenuDTO()
                .setParentId(bo.getParentId())
                .setMenuName(bo.getMenuName())
                .setMenuType(bo.getMenuType())
                .setTreeSort(bo.getTreeSort())
                .setIcon(bo.getIcon())
                .setPermission(bo.getPermission())
                .setPath(bo.getPath())
                .setComponent(bo.getComponent())
                .setHidden(bo.getHidden())
                .setIsShow(bo.getIsShow())
                ;
    }

}
